You are here: Custom Study Programming > Reference > Callback Functions > Functions > init

init

This is the callback function in which custom study sets up its configuration.

Syntax

init( );

Remarks

This callback is called once during study initialization, and is used as a placeholder for setting various settings and parameters for the study.

Example

The following example demonstrates init() callback function.

 

function init()

{

//setup study's initial settings

 

this.setName("cSMA");

this.addDataPlot("customSMA");

this.addParameter("Period", 10);

 

//set to true so that this study can use *any* data source

setAnyDataSource(true);

 

//moving average requires a minimum of periods to calculate one value

setMinRequiredDataValues(this.getParameter("Period"));

}

See Also

destroy(), calculate()

 


Copyright © 2006-2009 ActiveTick LLC